import Vue from 'vue'
import App from './App.vue'
import router from './router'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import '@/assets/css/global.css'
import axios from 'axios'
import monent from 'moment'

Vue.use(ElementUI);
Vue.config.productionTip = false

//全局变量
//挂载axios
Vue.prototype.$http = axios
axios.defaults.baseURL="/api"
//axios提供拦截器 发送或者响应之前 之后都可以拦截
axios.interceptors.request.use((req) => {
  //获取 token
  let token = sessionStorage.getItem("token");
  if (token != null) {
    req.headers.token = token;
  }
  return req;
});



Vue.filter('datefmt', function (data, formatStr) {
  return monent(data).format(formatStr)
});


new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
